extends CharacterBody2D

@onready var multiplayer_synchronizer: MultiplayerSynchronizer = $MultiplayerSynchronizer

#player data
var move_speed : float = 180.0

func _physics_process(_delta: float) -> void:
	move_and_slide()
	velocity = Vector2.ZERO

@rpc("any_peer")
func _move(dir : Vector2) -> void :
	if not name == str(multiplayer.get_remote_sender_id()) : return
	velocity = dir * move_speed

func _on_destory_event(id : int) -> void :
	if not name == str(id) : return
	call_deferred("queue_free")

func _set_synchronizer(peer_id : int, visible_value : bool) -> void :
	multiplayer_synchronizer.set_visibility_for(peer_id,visible_value)
